﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TMIS.DAL
{
    public class ReviewOpinion
    {
        private Model.ThesisDB db = new Model.ThesisDB();

        #region 更新评阅教师评阅意见表信息
        public void Update(Model.ReviewOpinion reviewopinion)
        {
            Model.ReviewOpinion rev = db.ReviewOpinion.Single(e => e.ID == reviewopinion.ID);
            rev.Topic = reviewopinion.Topic;
            rev.Survey = reviewopinion.Survey;
            rev.Demonstrate = reviewopinion.Demonstrate;
            rev.Quality = reviewopinion.Quality;
            rev.Innovation = reviewopinion.Innovation;
            rev.TotalScore = reviewopinion.TotalScore;
            db.SubmitChanges();
        }
        #endregion

        /// <summary>
        /// 获取指定ID号的评阅教师意见表
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public Model.ReviewOpinion Get(Guid guid)
        {
            Model.ReviewOpinion rev= db.ReviewOpinion.FirstOrDefault(e => e.ID == guid);
            return rev;
        }
        /// <summary>
        /// 生成新的评阅教师评阅意见表
        /// </summary>
        /// <param name="reviewOpinion"></param>
        public void Insert(Model.ReviewOpinion reviewOpinion)
        {
            db.ReviewOpinion.InsertOnSubmit(reviewOpinion);
            db.SubmitChanges();
        }
    }
}
